{% extends 'myadmin/base.html' %}
{% block title %}
<title>Book-shop订单管理</title>
{% endblock %}
{% block con %}
<section class="wrapper">
<div class="row">
    <div class="col-lg-8">
        <h3 class="page-header"><i class="fa fa-users"></i> 图书订单管理</h3>
    </div>
</div>
    <section class="panel">
    <header class="panel-heading">
        图书订单列表
    </header>
        <div class="panel-body">
            <a href="{% url 'myadmin_books_add' %}" class="btn btn-success" data-toggle="modal" href="#myModal">新增</a>
            <a class="btn btn-warning" data-toggle="modal" href="#myModal2">保存</a>

            <div class="btn-group pull-right">
                <input class="form-control" placeholder="搜索" type="text" name="keywords">
            </div>

            <div class="btn-group pull-right">
                <select class="form-control" name="selecttype">
                    <option value="all">所有字段</option>
                    <option value="phone">图书名</option>
                    <option value="nikename">作者</option>
                    <option value="sex">出版社</option>
                </select>
            </div>
        </div>
        <table class="table table-striped table-advance table-hover">
            <thead>
            <tr>
                <th> ID </th>
                <th> 图片 </th>
                <th> 书名 </th>
                <th> 单价 </th>
                <th> 数量 </th>
                <th> 小计 </th>
                <th> 操作 </th>
            </tr>
            </thead>
            <tbody>
            {% for i in user.cart_set.all %}
            <tr>
                <td>{{i.id}}</td>
                <td><img src="/{{i.bid.bookimgs_set.first.img_url }}" class="tpl-table-line-img"
                         style="max-width: 50px; min-width: 45px;"></td>
                <td><span class="tname">{{i.bid.title}}</span></td>
                <td>{{i.bid.price}}</td>
                <td> <input class="input" name="num" type="number" min="1" value="{{i.num}}">
                    <input type="hidden" name="cartid" value="{{i.id}}">
                </td>
                <td>{% widthratio i.bid.price 1 i.num %}</td>
                <td>
                    <div class="btn-group">
                        <a class="btn btn-info">编辑</a>
                        <a href="javascript:;" class="btn btn-danger">
                            <i class="icoclose_alt">删除</i></a>
                    </div>
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        <ul class="pagination pull-right">
            {% load pagetag %}
            <!-- 使用自定义分页标签 -->
            {% showpage data.paginator.num_pages request %}
        </ul>
    </section>
</section>
{% endblock %}